﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;

namespace WEB.Controllers
{
    public class ComentarioController : Controller
    {

       
        //
        // GET: /Comentario/

        public ActionResult Index()
        {
            return View();
        }

        //
        // GET: /Comentario/Details/5

        public ActionResult detalhes(int id)
        {
            return View();
        }

        //
        // GET: /Comentario/Create

        public ActionResult novo()
        {
            return View();
        } 

        //
        // POST: /Comentario/Create

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult novo(FormCollection collection)
        {
            try
            {

                Comentario bllCom = new Comentario();
                tbComentario objCom = new tbComentario()
                                          {
                                              idUsuario = 1,
                                              idObjeto = 3,
                                              idSituacao = 1,
                                              txtComentario = collection[1],
                                              dtInclusao = DateTime.Now
                                          };


                bllCom.InserirAtualizar(objCom);
                bllCom.Salvar();
                // TODO: Add insert logict here
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        //
        // GET: /Comentario/Edit/5
 
        public ActionResult Edit(int id)
        {
            return View();
        }

        //
        // POST: /Comentario/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Comentario/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View();
        }

        //
        // POST: /Comentario/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
 
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
